/**
 * Copyright (c) 2011-2020, hubin (jobob@qq.com).
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.baomidou.mybatisplus.generator.config;

import com.baomidou.mybatisplus.toolkit.StringUtils;

/**
 * <p>
 * 跟包相关的配置项
 *
 * @author YangHu, tangguo
 * @since 2016-08-30
 */
public class PackageConfig {

	/**
	 * 父包名。如果为空，将下面子包名必须写全部， 否则就只需写子包名
	 */
	private String parent = "com.baomidou";

	/**
	 * 父包模块名。
	 */
	private String moduleName = null;

	/**
	 * Entity包名
	 */
	private String entity = "entity";

	/**
	 * Service包名
	 */
	private String service = "service";

	/**
	 * Service Impl包名
	 */
	private String serviceImpl = "service.impl";
	/**
	 * Mapper包名
	 */
	private String mapper = "mapper";

	/**
	 * Mapper XML包名
	 */
	private String xml = "mapper.xml";

	/**
	 * Controller包名
	 */
	private String controller = "web";

	public String getParent() {
		if (StringUtils.isNotEmpty(moduleName)) {
			return parent + "." + moduleName;
		}
		return parent;
	}

	public String getModuleName() {
		return moduleName;
	}

	public void setModuleName(String moduleName) {
		this.moduleName = moduleName;
	}

	public String getEntity() {
		return entity;
	}

	public void setEntity(String entity) {
		this.entity = entity;
	}

	public String getService() {
		return service;
	}

	public void setService(String service) {
		this.service = service;
	}

	public String getServiceImpl() {
		return serviceImpl;
	}

	public void setServiceImpl(String serviceImpl) {
		this.serviceImpl = serviceImpl;
	}

	public String getMapper() {
		return mapper;
	}

	public void setMapper(String mapper) {
		this.mapper = mapper;
	}

	public String getXml() {
		return xml;
	}

	public void setXml(String xml) {
		this.xml = xml;
	}

	public void setParent(String parent) {
		this.parent = parent;
	}

	public String getController() {
		if (StringUtils.isEmpty(controller)) {
			return "web";
		}
		return controller;
	}

	public void setController(String controller) {
		this.controller = controller;
	}

}
